 var id = getvl("id");
 $(function(){
 	  if(id!=''){
 	  	useradmin();
 	  }else{
 	  	alert("异常");
 	  }
 });
 function useradmin(){
	$.ajax({
		url: urlcore + "/api/user/selectOne?id="+id,
		type: "get",
		dataType: 'json',
		contentType: "application/json;charset=utf-8",
		success:function(data){
			if (data.success == true) {
		         var  da=data.data;
		     $("#imghead").attr("src",da.headImg);
	//var gmtDatetime = new Date().pattern("yyyy-MM-dd");
						
		      var gerenziliao='<div class="buy_ziliao">'+
'    <ul class="mid-width">'+
'        <li>';
         if(da.userName!=null && da.userName!=""){
         	 gerenziliao+='<input type="text" class="buy_nicheng" value="'+da.userName+'" id="username" placeholder="取个好听的昵称" />';
         }else{
         	 gerenziliao+='<input type="text" class="buy_nicheng" value="'+da.wxName+'" id="username" placeholder="取个好听的昵称" />';
         }
//'        
      
gerenziliao+=' </li>';
     if(da.gmtDatetime!=null && da.gmtDatetime!=""){
     	gerenziliao+='        <li>注册时间<em>'+da.gmtDatetime+'</em></li>';
     }else{
     		gerenziliao+='        <li>注册时间<em></em></li>';
     }

gerenziliao+='        <li>';
   if(da.isMember==1){
			    if(da.memberTime!=null && da.memberTime!=""){
			    	 var oDate1 = new Date(da.memberTime);
              var oDate2 = new Date();
              if(oDate1.getTime()>oDate2.getTime()){
              	
              	if(da.member!=null && da.member!=""){
              	  gerenziliao+='<a href="12.13.0huiyuangoumai.html?id='+da.id+'">会员等级<i>VIP'+da.member.level+'</i></a>';
             	
              	}else{
              		  gerenziliao+='<a href="12.13.0huiyuangoumai.html?id='+da.id+'">会员等级<i>VIP0</i></a>';
             
              	}
             }else{
            gerenziliao+='<a href="12.13.0huiyuangoumai.html?id='+da.id+'">会员等级<i>未购买</i></a>';
              }
			    	}
			    }else{
			    gerenziliao+='            <a href="12.13.0huiyuangoumai.html?id='+da.id+'">会员等级<i>未购买</i></a>';
			    }


  gerenziliao+='   </li> '+
'    </ul>'+
'</div>'+
'<div class="buy_ziliao">'+
'    <ul class="mid-width">'+
'        <li>'+
'            <a href="../11.2.3dizhi.html?id='+id+'">收货地址</a>'+
'        </li>     '+
'    </ul>'+
'</div>';
             $("#touxiang").val(da.headImg);
		   $("#gerenziliao").append(gerenziliao);   
		      
			}else{
				alert("未获取到信息");
				//chaxundingdanxinxi(1,idss);
			//	window.location.href="../1.0.0denglu.html";
			}
		},
		error:function() {
			/* Act on the event */
			alert("error");
		}
	});	
 }


function baochun(){
	
	
	 var touxiang=$("#touxiang").val();
	 var username=$("#username").val();
    	 $.ajax({
		url: urlcore + "/api/user/userUpdate",
		type: "post",
		contentType: "application/json;charset=utf-8",
		data: JSON.stringify({
			"id":id,
			"headImg":touxiang,
			"userName":username
		}),
		dataType: "json",
		success: function(data) {
			if(data.success == true) {
			     alert("修改成功。");
          }else{
          	alert("修改失败");
          }
		},
		error: function() {
			alert("error");
		}
	});
   

}
